<?php
/**
 * Created by PhpStorm.
 * User: jacob
 * Date: 18-11-7
 * Time: 下午2:35
 * CLI运行入口文件
 */
namespace CLI;

class CLIStart{
  static public function main(){
    date_default_timezone_set("PRC");
    ini_set("display_errors","Off");
    spl_autoload_register(function ($className){
      $data = explode("\\",$className);
      if (empty($data[0] || $data[0] == "")){
        array_shift($data);
      }
      $last_item = array_pop($data);
      $map_data = array_map("strtolower",$data);
      $map_data[] = $last_item;
      $className = implode("/",$map_data);
      if (file_exists($className.".inc")){
        require_once $className.".inc";
      }
    });
    /*--------------PhpInit----------------*/
    \PhpInit::loadClass();
    \PhpInit::init();
    /*--------------PhpInit----------------*/

    $longopt = [
      "c:"
    ];
    $param = getopt("",$longopt);
    $head = [
      "\CLI\\",
    ];
    array_push($head,$param['c']);
    $obj = implode("",$head);
    /**
     * @var $obj CLI
     */
    $obj = new $obj;
    $obj->process();
  }
}

CLIStart::main();

